<template>
	<!-- 设置 -->
	<view>
		<!-- <naviTitle tit="设置" /> -->
		<navigator url='./notice' class="head">
			<view class="flex-cb bg-white head_main">
				<view class="left flex justify-between">
					<view class="bgimg flex-c">
						<image src="/static/pageA/xt.png" mode=""></image>
					</view>
					<view>
						<view class="notice">平台通知</view>
						<view class="remind">更新升级提醒</view>
					</view>
				</view>
				<view class="right flex-c" v-if="num">{{num}}</view>
			</view>
		</navigator>
		<!-- 订单通知 -->
		<navigator url="./new_order" class=" head1 head">
			<view class="flex-cb bg-white head_main">
				<view class="left flex-cb">
					<view class="bgimg flex-c">
						<image src="/static/pageA/icon_kfxx.png" mode=""></image>
					</view>
					<view>
						<view class="notice">订单通知</view>
					</view>
				</view>
				<view class="right flex-c" v-if="list">{{list}}</view>
			</view>
		</navigator>
		<!-- 代金券 -->
		<navigator url="./voucher" class=" head1 head">
			<view class="flex-cb bg-white head_main">
				<view class="left flex-cb">
					<view class="bgimg flex-c">
						<image src="@/static/pageA/djq.png" mode=""></image>
					</view>
					<view>
						<view class="notice">抵用券管理</view>
					</view>
				</view>
				<!-- <view class="right flex-c" v-if="list">{{list}}</view> -->
			</view>
		</navigator>
		<!-- 管理员 -->
		<navigator url="./adminUser" class=" head1 head">
			<view class="flex-cb bg-white head_main">
				<view class="left flex-cb">
					<view class="bgimg flex-c">
						<image src="@/static/pageA/djq.png" mode=""></image>
					</view>
					<view>
						<view class="notice">管理员</view>
					</view>
				</view>
				<!-- <view class="right flex-c" v-if="list">{{list}}</view> -->
			</view>
		</navigator>
		<!--  -->
		<!-- <navigator url="./order_detalis" class=" head1 head" > -->
		<view @click="toUrl('/pages/TUI-Conversation/conversation/conversation')" class=" head1 head">
			<view class="flex-cb bg-white head_main">
				<view class="left flex-cb">
					<view class="bgimg flex-c">
						<image src="/static/pageA/yhxx.png" mode=""></image>
					</view>
					<view>
						<view class="notice">用户消息</view>
					</view>
				</view>
				<!-- <view class="right flex-c">1</view> -->
			</view>
		</view>
		<view class=" head1 head" @click="isshow = 1">
			<view class="flex-cb bg-white head_main">
				<view class="left flex-cb">
					<view class="bgimg flex-c">
						<image src="/static/pageA/icon_kfxx(1).png" mode=""></image>
					</view>
					<view>
						<view class="notice">平台客服</view>
						<!-- <view class="remind">更新升级提醒</view> -->
					</view>
				</view>
				<!-- <view class="right flex-c">3</view> -->
			</view>
		</view>
		<navigator url="./DY_setup" class=" head1 head">
			<view class="flex-cb bg-white head_main">
				<view class="left flex-cb">
					<view class="bgimg flex-c">
						<image src="/static/pageA/dysz.png" mode=""></image>
					</view>
					<view>
						<view class="notice">打印设置</view>
					</view>
				</view>
				<!-- <view class="right flex-c">1</view> -->
			</view>
		</navigator>
		<view class="button flex-c" @click="tc_login">退出登陆</view>
		<!-- 客服 -->
		<view class="mobilePhone modal_view" v-if="isshow">
			<view class="phone_num" @click="handlePhone">{{phone}}</view>
			<view class="cancel" @click="isshow = 0">取消</view>
		</view>
		<view style="width: 100%; height: 200rpx;"></view>
		<tabbar isTab='3' :num="list" />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				isshow: 0,
				phone: '',
				list: '', //订单未读数
				num: 0
			};
		},
		onLoad() {
			this.$api.service_phone({}, 1).then(res => {
				console.log(res);
				this.phone = res.data
			})
			this.$api.merchants_order_messages_unread_number().then(res => {
				console.log(res);
				this.list = res.data
			})
			this.$api.unread_count().then(res => {
				console.log(res);
				this.num = res.data.unread_count
			})
		},
		methods: {
			tc_login() {
				uni.showModal({
					confirmColor: '#1CD699',
					content: '是否确认退出登录吗？',
					title: '退出登录',
					success: (res) => {
						if (res.confirm) {
							uni.setStorageSync("openid", '');
							uni.setStorageSync('userinfo', '')
							uni.setStorageSync("expires_in", '');
							uni.setStorageSync("token_type", '');
							uni.setStorageSync("access_token", '');
							uni.switchTab({
								url: '/pages/tabbar/index'
							})
						}
					}
				})
			},
			handlePhone() {
				uni.makePhoneCall({
					phoneNumber: this.phone,
				})
			},
			toUrl(url){
				console.log("跳转")
				uni.switchTab({
					url: url
				})
			}
		}
	}
</script>

<style lang="scss">
	.head {
		height: 240rpx;
		width: 100%;
		background: #1CD699;
		padding-top: 30rpx;

		.head_main {
			width: 710rpx;
			height: 164rpx;
			background: #FFFFFF;
			border-radius: 10rpx;
			margin: auto;
			padding: 33rpx 30rpx;

			.left {
				.bgimg {
					width: 98rpx;
					height: 98rpx;
					border-radius: 50%;
					background: #1CD699;
					margin-right: 28rpx;

					image {
						width: 42rpx;
						height: 40rpx;
					}
				}

				.notice {
					color: #0C1220;
					font-size: 30rpx;
					font-weight: bold;
				}

				.remind {
					font-size: 26rpx;
					color: #999999;
					margin-top: 11rpx;
				}
			}

			.right {
				width: 40rpx;
				height: 40rpx;
				background: #FF2E2E;
				color: #FFFFFF;
				border-radius: 50%;
			}
		}
	}

	.head1 {
		padding: 20rpx;
		height: 120rpx;
		margin-bottom: 20rpx;
		background: none;
	
	.head_main {
			padding: 16rpx 22rpx;
			height: 120rpx;

			.left {
				.bgimg {
					background: none;
					width: 88rpx;
					height: 88rpx;

					image {
						width: 100%;
						height: 100%;
					}
				}
			}
		}
	}

	.button {
		width: 711rpx;
		height: 120rpx;
		background: #E5E5E5;
		margin: auto;
		margin-top: 121rpx;
		font-size: 34rpx;
		color: #333;
	}

	.mobilePhone {
		position: fixed;
		z-index: 1000;

		view {
			width: 710rpx;
			height: 116rpx;
			background: #FFFFFF;
			border-radius: 14rpx;
			position: fixed;
			left: 21rpx;
			bottom: 158rpx;
			text-align: center;
			line-height: 116rpx;
		}

		.phone_num {
			font-size: 30rpx;
			color: #1CD699;
			font-weight: bold;
		}

		.cancel {
			font-size: 32rpx;
			font-weight: 500;
			bottom: 26rpx;
		}
	}
</style>
